package edu.rit.drh4818.raytracing.awt;

import java.awt.Dimension;
import java.awt.Point;

import javax.swing.JFrame;
import javax.swing.UIManager;

/**
 * Class which forms UI, requests the scene from the renderer,
 *  and then draws it onto the graphics object.
 * 
 * @author Darren Headrick
 *
 */
@SuppressWarnings("serial")
public class Screen extends JFrame 
{
	/**
	 * Size of the window.
	 */
	public static final Dimension SIZE = new Dimension( 600, 500 );
	
	/**
	 * Location for window.
	 */
	public static final Point LOCATION = new Point( 200, 100 );
	
	/**
	 * Create a new screen.
	 * @param render Renderer to use to generate the view.
	 */
	public Screen( String name )
	{
		super( name );
		setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
		setResizable( Boolean.FALSE );
		getContentPane().add( new RayTracingRenderer() );
		pack();
		setLocation( LOCATION );
	}
	
	/**
	 * Set up the screen in a JFrame, also initialize all the objects in scene.
	 * @param args
	 */
	public static void main( String[] args )
	{	
		try
		{
			UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
		}
		catch( Exception e )
		{}

		// display the scene.
		JFrame frame = new Screen( "Ray Tracer" );
		frame.setVisible( true );
	}
}

